cmake_minimum_required(VERSION 3.1.0)
project(assign2)

set(LLVM_DIR "/home/teacher/Glucose180/llvm-19.1.0")
set(LLVM_INCLUDE_DIRS "${LLVM_DIR}/include")
set(LLVM_LIBRARY_DIRS "${LLVM_DIR}/lib")
set(CLANG_INCLUDE_DIRS "${LLVM_DIR}/include/clang")
set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_C_COMPILER "${LLVM_DIR}/bin/clang")
#set(CMAKE_CXX_COMPILER "${LLVM_DIR}/bin/clang++")

find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} ${LLVM_DIR}/lib/cmake/llvm NO_DEFAULT_PATH)

include_directories(${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS} SYSTEM)
link_directories(${LLVM_LIBRARY_DIRS})
message(STATUS "LLVM_LIB DIR : ${LLVM_LIBRARY_DIRS}")
set(LLVM_LINK_COMPONENTS
  LLVMCore
  LLVMIRReader
  LLVMPasses
  LLVMBitWriter
  LLVMSupport
)

set(CMAKE_VERBOSE_MAKEFILE ON)

message(STATUS "LLVM LIBS : ${LLVM_LINK_COMPONENTS}")
# Support plugins.

add_executable(HomeworkLLVM
  src/LLVMAssignment.cc
)

target_compile_options(HomeworkLLVM PRIVATE -fno-rtti)

target_link_libraries(HomeworkLLVM
	${LLVM_LINK_COMPONENTS}
)
